/*
 * Copyright (c) 2017,安徽皖通科技股份有限公司 All rights reserved.
 */

package com.wttech.dzzf.process.service.govern;

import com.wtkj.vo.dzzf.base.kfwd.CardInfo;
import com.wtkj.vo.dzzf.base.kfwd.FundAccount;
import com.wttech.dzzf.process.dao.DataGovernDao;
import com.wttech.dzzf.process.service.test.FundAccountCheck;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * 资金账户信息治理
 *
 * @author MaShibo
 * @date 2017/12/10.
 */
@Service
public class FundAccountGovernService {

	@Resource
	private DataGovernDao dataGovernDao;

	@Resource
	private FundAccountCheck fundAccountCheck;

	@Resource
	private CardInfoGovernService cardInfoGovernService;

	public void governFundAccount(FundAccount fundAccount) {
		fundAccountCheck.checkFundAccount(fundAccount);
		processCardInfos(fundAccount.getFundAccountId());
	}

	private void processCardInfos(String fundAccountId) {
		List<CardInfo> cardInfos = dataGovernDao.queryCardInfosByFundAccountId(fundAccountId);
		cardInfos.forEach(cardInfo -> cardInfoGovernService.governCardInfo(cardInfo));
	}

}
